<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Calendar"%>
<%@page import="wt.doc.WTDocument"%>
<%@page import="wt.fc.ReferenceFactory"%>
<%@page import="shmged.com.shlcm.utils.CmIBAHelper"%>
<%@page import="wt.lifecycle.LifeCycleTemplate"%>
<%@page import="wt.lifecycle.PhaseTemplate"%>
<%@page import="wt.lifecycle.State"%>
<%@page import="wt.lifecycle.LifeCycleTemplateMaster"%>
<%@page import="java.util.Vector"%>
<%@page import="wt.lifecycle.LifeCycleHelper"%>
<%@page import="wt.lifecycle.LifeCycleManaged"%>
<%@page import="wt.lifecycle.LifeCycleServerHelper"%>
<%@page import="shmged.com.shlcm.utils.CmCreateUtil"%>
<%@page import="shmged.com.shlcm.reimbursement.CmShowPartHelper"%>
<%@page import="java.util.Date"%>
<%@page import="shmged.com.shlcm.utils.CSCUtil"%><html >
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="wt.httpgw.URLFactory"%>
<%@include file = "/shmged/jsp/com/shlcm/portal/main/head.jsp" %>

<html>
<head>
<title>查看费用报销</title>
<link rel="stylesheet" type="text/css" href="<%=baseUrl%>shmged/javascript/util/jquery-easyui-1.3.3/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="<%=baseUrl%>shmged/javascript/util/jquery-easyui-1.3.3/themes/icon.css">
<script type="text/javascript">var pageBaseUrl = "<%=baseUrl%>";</script>
<script type="text/javascript" src="<%=baseUrl%>shmged/javascript/util/jquery-easyui-1.3.3/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="<%=baseUrl%>shmged/javascript/util/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=baseUrl%>shmged/jsp/com/shlcm/portal/js/main.js"></script>
<style type="text/css">
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
</style>
</head>
<body>
<%

	ReferenceFactory rf=new ReferenceFactory();
	String oid=request.getParameter("oid");
	WTDocument doc = (WTDocument)rf.getReference(oid).getObject();
	CmIBAHelper holder = new CmIBAHelper(doc);

	String sum= holder.getIBAValue("Sum");
	String amount= holder.getIBAValue("Amount");
	String rbType= holder.getIBAValue("RefeBursementType");
	String rbState= doc.getLifeCycleState().getDisplay();
	Calendar cal = Calendar.getInstance(); 
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
	String cdate = sdf.format(cal.getTime()); 
	String time=holder.getIBAValue("Time").replace('/','-');
	time=time.substring(0,time.lastIndexOf("-")+3);
	String[] types=CmCreateUtil.getReimbursementType();
	String[] detailTypes=CmCreateUtil.getDetailType();
	
	CmShowPartHelper cm = new CmShowPartHelper(oid); 
	String timeStr = "";
	Date dt = new Date();
	cal.add(Calendar.HOUR,8);
	SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	timeStr = f.format(cal.getTime());
	String userFullName=CSCUtil.getFullNameWithUserName(holder.getIBAValue("PersonalNo"));
%>



<center>
<div style="margin:10px 0;"></div>
	<div  iconCls="icon-kms-related" title="费用报销单信息" style="width:700px; height: 400px; padding: 5px;" id="update_browseCreateReimbursement"  >
		<center>
		<form method="post" enctype="multipart/form-data" name="updateRBForm" id="updateRBForm">
	 <div  class="easyui-panel" title="报销单" align="center">		
		<table  width="600px">
			
			
			<tr>
				<td  align="right">单据号:</td>
				<td width="10xp"></td>
				<td align="left"><%=doc.getName() %></td>
				<td align="right">发票数:</td>
				<td width="10xp"></td>
				<td align="left"><%=(holder.getIBAValue("InvoiceNum")==null)?"0":holder.getIBAValue("InvoiceNum") %></td>
			</tr>
			
			
			<tr>
				<td align="right">项目编号:</td>
				<td width="10xp"></td>
				<td align="left"><%=(holder.getIBAValue("ProjectNo")==null)?"": holder.getIBAValue("ProjectNo")%></td>
				<td align="right">项目名称:</td>
				<td width="10xp"></td>
				<td align="left"><%=(holder.getIBAValue("ProjectName")==null)?"": holder.getIBAValue("ProjectName")%></td>
			</tr>
			<tr>
				<td align="right">报销日期:</td>
				<td width="10xp"></td>
				<td align="left"><%=time%></td>
				<td align="right">报销人:</td>
				<td width="10xp"></td>
				<td align="left"><%=userFullName %></td>
			</tr>
				
			<tr>
				<td align="right">单据类型:</td>
				<td width="10xp"></td>
				<td align="left"><%=holder.getIBAValue("RefeBursementType") %>
				</td>
				<td align="right">付款方式:</td>
				<td width="10xp"></td>
				<td align="left"><%=holder.getIBAValue("PayMethod") %>
				</td>
			</tr>
			
			<tr>
				<td align="right">报销金额(小写):</td>
				<td width="10xp"></td>
				<td align="left"><%=sum %></td>
				<td align="right" readonly="readonly">报销金额(大写):</td>
				<td width="10xp"></td>
				<td align="left"><%=amount %></td>
			</tr>
		</table>
		</div>

		<div style="margin:10px 0;"></div>
		
		<div  class="easyui-panel" title="附件" align="center">
			<table id="accessory" width="600px" style="height:80px"></table>
		</div>
		
		<div style="margin:10px 0;"></div>
		
	 	<table id="update_detailTable" class="easyui-datagrid" title="费用明细" style="height:250px" width="width:600px"
					data-options="rownumbers:true,singleSelect:true,toolbar:'#update_detailButton',onClickRow: onClickRow">
		</table>
		
		<div id="update_detailButton" style="padding:5px;height:auto">
		</div>		
	</form>
		</center>
		
</div>


</center>
<script type="text/javascript">
initUpdate_detailTable();
var update_editIndex = undefined;

function onClickRow(index)
{
	update_editIndex=index;
}
function initUpdate_detailTable(){
	var oid="<%=oid%>";
	var url='<%=baseUrl%>shmged/jsp/com/shlcm/reimbursement/jspGetReimbursementDetialList.jsp';
	  $('#update_detailTable').datagrid({   
	      url:url,
	      queryParams:{oid:oid},
	      nowrap:false,
	      loadMsg:'正在加载数据，请稍等。。。',
		  fitColumns: true,
	      columns:[[   
	          {field:'detailType',title:'费用类型',width:40}, 
	          {field:'detailAmount',title:'金额',width:40},
	          {field:'detailTo',title:'用途',width:40},
	          {field:'detailTime',title:'时间',width:40},
	          {field:'detailDesc',title:'备注',width:40}
	      ]] 
	    }); 
}

function uodate_setSum()
{
	
	var rows = $("#update_detailTable").datagrid('getRows');
	var infos="";
	for(var i=0; i<rows.length; i++){
		infos=Number(infos)+Number(rows[i].detailAmount);
	}
	document.getElementById("add_update_Sum").value=infos;
	document.getElementById("add_update_Amount").value=convertCurrency(infos);
}

</script>

<script>
function downloadFiles2(fileName)
{
	var oids="";
	oids+="<%=oid%>"+"__"+fileName;
	alert(oids);
	window.location.href="<%=baseUrl%>shmged/jsp/com/shlcm/documents/downLoadFiles2.jsp?oids="+oids;
}
</script>

<script>
	initDocTable2("<%=oid%>");
	
	function initDocTable2(oid){
			var url='<%=baseUrl%>shmged/jsp/com/shlcm/documents/jspSearchPrimary.jsp';
			  $('#accessory').datagrid({   
			      url:url,
			      queryParams:{oid:oid},
			      nowrap:false,
			      loadMsg:'正在加载数据，请稍等。。。',
				  fitColumns: true,
				  columns:[[   
							  <%--{field:'id',title:'id',width:100,checkbox:true}, --%>  
					          {field:'id',title:'名称',width:150,formatter:function(value,rowData,rowIndex){
			                    		 return "<a href=\"javaScript:void(0)\" onclick=\"javaScript:downloadFiles2(\'"+rowData.id+"\')\">"+rowData.name+"</a>"
			                    		  }
									},
  
					      ]] 
			    }); 
		}
</script>
</body>

</html>